﻿using SqlSugar;

namespace SqlSugarCore.Dal.BaseRealize
{
    /// <summary>
    /// dal层所有的dal都必须继承此类
    /// </summary>
    public partial class BaseDal<T> where T : class, new()
    {
        private readonly SqlSugarClient _sqlSugarClient;

        protected BaseDal(SqlSugarClient sqlSugarClient)
        {
            _sqlSugarClient = sqlSugarClient;
        }

        /// <summary>
        /// 开启事务
        /// </summary>
        public void BeginTran()
        {
            this._sqlSugarClient.BeginTran();
        }

        /// <summary>
        /// 提交事务
        /// </summary>
        public void CommitTran()
        {
            this._sqlSugarClient.CommitTran();
        }

        /// <summary>
        /// 回滚事务
        /// </summary>
        public void RollbackTran()
        {
            this._sqlSugarClient.RollbackTran();
        }

    }
}